package com.wuzheng.wisgo.sanitation.cloud.service.plan.impl;

import com.wuzheng.wisgo.sanitation.cloud.model.plan.param.JobPlanDetailVehicleParam;
import com.wuzheng.wisgo.sanitation.cloud.model.plan.param.TimeSlotParam;
import com.wuzheng.wisgo.sanitation.cloud.model.plan.pojo.JobPlanVehicleDTO;
import com.wuzheng.wisgo.sanitation.cloud.repository.entity.plan.JobPlanVehicle;
import com.wuzheng.wisgo.sanitation.cloud.repository.mapper.plan.JobPlanVehicleMapper;
import com.wuzheng.wisgo.sanitation.cloud.service.plan.JobPlanVehicleService;
import com.wuzheng.wisgo.sanitation.framework.base.service.impl.BaseServiceImpl;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author：hoipang
 * @date：Created in 2019-12-19
 * @description：道路作业计划与车辆关联服务实现类
 * @modified By：
 * @version: 1.0
 */
@Service
public class JobPlanVehicleServiceImpl extends BaseServiceImpl<JobPlanVehicle> implements JobPlanVehicleService {

    @Override
    public List<JobPlanVehicleDTO> listDetailVehicleDTOs(JobPlanDetailVehicleParam jobPlanDetailVehicleParam) {
        JobPlanVehicleMapper jobPlanVehicleMapper = this.getMapper(JobPlanVehicleMapper.class);

        //TODO 使用roadIds校验数据库是否存在该时间段内的计划
        List<TimeSlotParam> timeSlotParams = jobPlanDetailVehicleParam.getTimeSlotParams();
        List<JobPlanVehicleDTO> list = jobPlanVehicleMapper.listVehicles(jobPlanDetailVehicleParam.getJobType(), timeSlotParams);

        return list;
    }

}
